/**
 * 
 */
package com.zeba.fundtransfer;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.zeba.R;
import com.zeba.fundtransfer.FundTransferActivity.FundTransferActivityEnum;

/**
 * @author Zeba
 *
 */
public class FundTransferActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.fundtransfer);
		
		setPayoutRequestPageTransition();
		setPayinRequestPageTransition();
		setTransferStatusPageTransition();
		
	}

	private void setTransferStatusPageTransition() {
		TextView textView = (TextView)findViewById(R.id.fundtransfer_transferstatus);
		FundTransferActivityListener listener = new FundTransferActivityListener();
		listener.setActivitySelected(FundTransferActivityEnum.TRANSFER_STATUS);
		listener.setCallerActivity(this);
		textView.setOnClickListener(listener);
	}

	private void setPayinRequestPageTransition() {
		TextView textView = (TextView)findViewById(R.id.fundtransfer_payinrequest);
		FundTransferActivityListener listener = new FundTransferActivityListener();
		listener.setActivitySelected(FundTransferActivityEnum.PAYIN);
		listener.setCallerActivity(this);
		textView.setOnClickListener(listener);
		
	}

	private void setPayoutRequestPageTransition() {
		TextView textView = (TextView)findViewById(R.id.fundtransfer_payoutrequest);
		FundTransferActivityListener listener = new FundTransferActivityListener();
		listener.setCallerActivity(this);
		listener.setActivitySelected(FundTransferActivityEnum.PAYOUT);
		textView.setOnClickListener(listener);
		
	}	
	
	
	private class FundTransferActivityListener implements OnClickListener {

		private FundTransferActivity activity;
		private FundTransferActivityEnum activitySelected;

		public void setCallerActivity(FundTransferActivity activity){
			this.activity = activity;
		}
		
		public void setActivitySelected(FundTransferActivityEnum activitySelected){
			this.activitySelected = activitySelected;
		}
		
		public void onClick(View v) {
			
			Intent intent = null;
			switch(activitySelected){
			case PAYOUT:
				intent = new Intent(activity, PayoutRequestActivity.class);
				break;
			case PAYIN:
				intent = new Intent(activity, PayinRequestActivity.class);
				break;
			case TRANSFER_STATUS:
				intent = new Intent(activity, TransferStatusActivity.class);
				break;
			default:
				intent = new Intent(activity, TransferStatusActivity.class);
			}
			activity.startActivity(intent);
		}
		
	}
	
	public static enum FundTransferActivityEnum{ 
			PAYOUT,  
			PAYIN,
			TRANSFER_STATUS;  
		
	}
}
